package xyz.riceball.develop.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import xyz.riceball.develop.entity.po.DictionaryPO;
import xyz.riceball.framework.core.bean.ApiR;
import xyz.riceball.framework.core.bean.ApiRc;

import java.util.List;

/**
 * 字典表(Dictionary)表服务接口
 *
 * @author xiaovcloud
 * @since 2022-04-26 13:11:31
 */
public interface DictionaryService extends IService<DictionaryPO> {
    /**
     * 查询字典分类
     *
     * @param page
     * @param wrapper
     * @return
     */
    Page<DictionaryPO> pageCategory(Page<DictionaryPO> page, DictionaryPO dictionary);

    /**
     * 查询字典项目
     *
     * @param page
     * @param wrapper
     * @return
     */
    Page<DictionaryPO> pageItem(Page<DictionaryPO> page, DictionaryPO dictionaryPO);

    /**
     * 新增字典分类
     *
     * @param dictionary
     * @return
     */
    ApiR<DictionaryPO> addCategory(DictionaryPO dictionary);

    /**
     * 新增字典项
     *
     * @param dictionary
     * @return
     */
    ApiR<DictionaryPO> addItem(DictionaryPO dictionary);

    /**
     * 修改字典
     *
     * @param dictionary
     * @return
     */
    boolean edit(DictionaryPO dictionary);

    /**
     * 修改字典项
     *
     * @param dictionary
     * @return
     */
    boolean editItem(DictionaryPO dictionary);

    /***
     * 删除字典分类
     * @param codeList
     * @return
     */
    ApiRc delete(List<String> codeList);

    /**
     * 删除字典项
     *
     * @param ids
     * @return
     */
    ApiRc<Void> deleteItem(List<String> ids);

    /**
     * 根据字典codes查询字典
     *
     * @param values
     * @return
     */
    List<List<DictionaryPO>> selectItem(List<String> values);

    /**
     * 根据字典code和字典的value查询字典
     *
     * @param code
     * @param values
     * @return
     */
    List<DictionaryPO> selectItem(String code, List<String> values);
}

